package com.hundsun.bontal.hbi.hbi.controller;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.UUID;
import com.hundsun.bontal.hbi.hbi.api.CommonResult;
import com.hundsun.bontal.hbi.hbi.service.IMSUnderwritingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName IMSUnderwriting
 * @Description TODO
 * @Author wdl
 * @Date 2022/3/30 17:13
 * @Version
 */
@RestController
@RequestMapping("/v1/report")
public class IMSUnderwritingController {

    @Autowired
    private IMSUnderwritingService service;

    @RequestMapping(value = "/upload", method = RequestMethod.POST, consumes = "multipart/form-data")
    public CommonResult uploadMedicalReport(@Validated @RequestParam("file") MultipartFile multipartFile,
                                            @RequestParam(required = false,value = "isNeedStore" ) boolean isStore) throws IOException {

        return CommonResult.success(service.uploadFile(multipartFile,isStore));
    }
}